// ActionScript file
	import com.nhn.maps.NCoordType;
	import com.nhn.maps.NLatLng;
	import com.nhn.maps.NMap;
	import com.nhn.maps.controls.NIndexMap;
	import com.nhn.maps.controls.NZoomControl;
	import com.nhn.maps.enums.HorizontalAlignment;
	import com.nhn.maps.enums.VerticalAlignment;
	import com.nhn.maps.events.NMapEvent;
	import com.nhn.maps.overlays.NMarkParams;
	import com.nhn.maps.overlays.NPlaceMark;
	
	import flash.external.ExternalInterface;
	
	import mx.collections.ArrayCollection;
	import mx.collections.XMLListCollection;
	import mx.rpc.events.ResultEvent;

	private var totalMf:int;
	private var isInstalled:String;
	private var selectedMfPanel:int;
	private var friendsList:Array;
	private var maxPage:int;
	private var loadedMfIndex:int;
	
	[Bindable] private var selectedFSid:String;
	[Bindable] private var selectedFMainReportNum:String;
	private var fSex:String = "";
	private var fAge:String = "";
	private var fMainReportDate:String = "";
	private var fQoute:String = "";
	private var fBtype:String = "";
	private var fTtype:String = "";
	private var dataset_fProfile:XMLListCollection = new XMLListCollection;
	private var dataset_fMainReport:XMLListCollection = new XMLListCollection;
	private var dataset_fReport:XMLListCollection = new XMLListCollection;
	private var fChartBtypes:ArrayCollection;
	private var fChartTtypes:ArrayCollection;
	
	[Bindable] private var selectedPSid:String;
	[Bindable] private var selectedPMainReportNum:String;
	private var pDName:String = "";
	private var pContainer:String = "";
	private var pSex:String = "";
	private var pAge:String = "";
	private var pMainReportDate:String = "";
	private var pQoute:String = "";
	private var pBtype:String = "";
	private var pTtype:String = "";
	private var dataset_pProfile:XMLListCollection = new XMLListCollection;
	private var dataset_pMainReport:XMLListCollection = new XMLListCollection;
	private var dataset_pReport:XMLListCollection = new XMLListCollection;
	private var pChartBtypes:ArrayCollection;
	private var pChartTtypes:ArrayCollection;
	
	private var fMap:NMap;
	private var indexMapF:NIndexMap;
	private var zoomControlF:NZoomControl;
	private var placeMarkF:NPlaceMark;
	private var fLat:Number = 0;
	private var fLng:Number = 0;
	
	[Bindable] private var getFReportMode:String;
	[Bindable] private var getPReportMode:String;
	
	
	private function changedInstallTrue():void{
		isInstalled="true";
		ExternalInterface.call("prepareFriendsList", 'true', '1');
		tput_mfCurrentPage.text = "1";
		
		btn_recommendInstall.enabled = false;
		btn_readySendMsg.enabled = true;
		btn_viewFriendInfo.enabled = true;
		
		selectedFSid = "";
		lab_selectedMfDname.text = "";
		img_selectedMfPic.source = "";
		lab_selectedMfSex.text = "";
		lab_selectedMfAge.text = "";
		lab_selectedMfBtype.text = "";
		lab_selectedMfTtype.text = "";
		lab_selectedMfMainReportDate.text = "";
		area_selectedMfQoute.text = "";
		
		lab_getFListNoti.text = "끼리끼리를 설치한 친구들입니다.";
	}
	
	private function changedInstallFalse():void{
		isInstalled="false"
		ExternalInterface.call("prepareFriendsList", 'false', '1');
		tput_mfCurrentPage.text = "1";
		
		btn_recommendInstall.enabled = true;
		btn_readySendMsg.enabled = false;
		btn_viewFriendInfo.enabled = false;
		
		selectedFSid = "";
		lab_selectedMfDname.text = "";
		img_selectedMfPic.source = "";
		lab_selectedMfSex.text = "";
		lab_selectedMfAge.text = "";
		lab_selectedMfBtype.text = "";
		lab_selectedMfTtype.text = "";
		lab_selectedMfMainReportDate.text = "";
		area_selectedMfQoute.text = "";
		
		lab_getFListNoti.text = "아직 끼리끼리를 설치하지 않은 친구들입니다.";
	}
	
	private function previousMfPage():void{
		if(int(tput_mfCurrentPage.text)>1){
			var previousPage:int = int(tput_mfCurrentPage.text)-1;
			tput_mfCurrentPage.text = previousPage.toString();
			if(isInstalled == "true"){
				ExternalInterface.call("prepareFriendsList", 'true', previousPage);
			}else if(isInstalled == "false"){
				ExternalInterface.call("prepareFriendsList", 'false', previousPage);
			}
		}
	}
	
	private function nextMfPage():void{
		maxPage = ExternalInterface.call("getPageCount");
		if(int(tput_mfCurrentPage.text)<maxPage){
			var nextPage:int = int(tput_mfCurrentPage.text)+1;
			tput_mfCurrentPage.text = nextPage.toString();
			if(isInstalled == "true"){
				ExternalInterface.call("prepareFriendsList", 'true', nextPage);
			}else if(isInstalled == "false"){
				ExternalInterface.call("prepareFriendsList", 'false', nextPage);
			}
		}
	}
	
	private function changeCurrentMfPage():void{
		maxPage = ExternalInterface.call("getPageCount");
		if(int(tput_mfCurrentPage.text)>=1 && int(tput_mfCurrentPage.text)<=maxPage){
			var goPage:int = int(tput_mfCurrentPage.text);
			if(isInstalled == "true"){
				ExternalInterface.call("prepareFriendsList", 'true', goPage);
			}else if(isInstalled == "false"){
				ExternalInterface.call("prepareFriendsList", 'false', goPage);
			}
		}else{
			tput_mfCurrentPage.text = "1"
		}
	}
	
	private function viewFriendsList(fData:String, sendCount:int):void{
		// initialize
		img_picMf1.source=img_picMf2.source=img_picMf3.source=img_picMf4.source=img_picMf5.source=img_picMf6.source="";
		lab_dnameMf1.text=lab_dnameMf2.text=lab_dnameMf3.text=lab_dnameMf4.text=lab_dnameMf5.text=lab_dnameMf6.text="";
		
		vbx_friendBox1.visible = vbx_friendBox2.visible = vbx_friendBox3.visible = vbx_friendBox4.visible = vbx_friendBox5.visible = vbx_friendBox6.visible = false;
		vbx_friendBox1.visible = vbx_friendBox2.visible = vbx_friendBox3.visible = vbx_friendBox4.visible = vbx_friendBox5.visible = vbx_friendBox6.visible = true;
		
		// load and view
		friendsList = new Array;
		var combinedData:Array = fData.split(",");
		for(var i:int=0; i<sendCount; i++){
			friendsList[i] = new Array;
			friendsList[i] = combinedData[i].toString().split("|");
		}
		
		// 컨트롤배열이 불가능해서 일일히 해당 index가 존재하는지 검증. 
		img_picMf1.source = (Boolean(friendsList[0])) ? friendsList[0][0].toString() : "";	
		img_picMf2.source = (Boolean(friendsList[1])) ? friendsList[1][0].toString() : "";
		img_picMf3.source = (Boolean(friendsList[2])) ? friendsList[2][0].toString() : "";	
		img_picMf4.source = (Boolean(friendsList[3])) ? friendsList[3][0].toString() : "";
		img_picMf5.source = (Boolean(friendsList[4])) ? friendsList[4][0].toString() : ""; 	
		img_picMf6.source = (Boolean(friendsList[5])) ? friendsList[5][0].toString() : "";
		
		lab_dnameMf1.text = (Boolean(friendsList[0])) ? friendsList[0][3].toString() : "";	
		lab_dnameMf2.text = (Boolean(friendsList[1])) ? friendsList[1][3].toString() : "";
		lab_dnameMf3.text = (Boolean(friendsList[2])) ? friendsList[2][3].toString() : "";	
		lab_dnameMf4.text = (Boolean(friendsList[3])) ? friendsList[3][3].toString() : "";
		lab_dnameMf5.text = (Boolean(friendsList[4])) ? friendsList[4][3].toString() : "";	
		lab_dnameMf6.text = (Boolean(friendsList[5])) ? friendsList[5][3].toString() : "";
		
		maxPage = ExternalInterface.call("getPageCount");
		lab_mfTotalPage.text = maxPage.toString();
	}
	
	
	private function clickedMfPanel(selectedPanel:int):void{
		viewSelectedMfInfo(selectedPanel);
	}
	private function viewSelectedMfInfo(selectedMfPanel:int):void{
		loadedMfIndex = selectedMfPanel-1;
		img_selectedMfPic.source = friendsList[loadedMfIndex][0].toString();	// plpicURL
		lab_selectedMfDname.text = friendsList[loadedMfIndex][3].toString();	// displayName
		
		// view DB info
		if(isInstalled == "true"){
			if(Boolean(friendsList[loadedMfIndex][1].toString())){	selectedFSid = friendsList[loadedMfIndex][1].toString();	}else{	selectedFSid = "";	}
			
			reqGetFriendProfile.send();
			reqGetFriendQoute.send();
		}else if(isInstalled == "false"){
			if(Boolean(friendsList[loadedMfIndex][1].toString())){	selectedFSid = friendsList[loadedMfIndex][1].toString();	}else{	selectedFSid = "";	}
			
			lab_selectedMfSex.text = "앱을 설치하지 않은 친구입니다.";
			lab_selectedMfAge.text = "";
			lab_selectedMfBtype.text = "";
			lab_selectedMfTtype.text = "";
			lab_selectedMfMainReportDate.text = "";
			area_selectedMfQoute.text = "";
		}
	}
	
	private function recommendInstall():void{
		ExternalInterface.call("recommendInstall", selectedFSid);
	}
	
	private function getFriendProfile(event:ResultEvent):void{
		dataset_fProfile.removeAll();
		dataset_fProfile = new XMLListCollection(new XMLList(event.result));
		
		if(Boolean(dataset_fProfile.toString())==true){
			selectedFMainReportNum = dataset_fProfile.child("mainReport").text().toString();
			reqGetFriendMainReport.send();
			
			fSex = 	(Boolean(dataset_fProfile.child("sex").text())==true) ? dataset_fProfile.child("sex").text().toString() : null;
			fAge = 	(Boolean(dataset_fProfile.child("age").text())==true) ? dataset_fProfile.child("age").text().toString() : null;
			fLat = 	(Boolean(dataset_fProfile.child("lat").text())==true) ? Number(dataset_fProfile.child("lat").text())	: null;
			fLng = 	(Boolean(dataset_fProfile.child("lng").text())==true) ? Number(dataset_fProfile.child("lng").text())	: null;
			startMapFriend();
		}else{
			fBtype = null;	fTtype = null;
			lab_selectedMfSex.text = "프로필을 등록하지 않은 친구입니다.";
			lab_selectedMfAge.text = "";
			lab_selectedMfBtype.text = "";
			lab_selectedMfTtype.text = "";
			lab_selectedMfMainReportDate.text = "";
			area_selectedMfQoute.text = "";
		}
	}
	
	private function getFriendQoute(event:ResultEvent):void{
		var encodeFQoute:String = event.result.toString();
		fQoute = (Boolean(encodeFQoute)==true) ? unescape(encodeFQoute) : "";
		area_selectedMfQoute.text = (Boolean(fQoute)==true) ? ("오늘의 한마디 : "+fQoute) : "오늘의 한마디 : 미등록";
	}
	
	private function getFriendMainReport(event:ResultEvent):void{
		dataset_fMainReport.removeAll();
		dataset_fMainReport = new XMLListCollection(new XMLList(event.result));
		
		var fCombinedPoint:String = dataset_fMainReport.child("combinedPoint").text().toString();
		
		
		var eS:int=int(fCombinedPoint.substr(0,2));		var eN:int=int(fCombinedPoint.substr(2,2));
		var eT:int=int(fCombinedPoint.substr(4,2));		var eF:int=int(fCombinedPoint.substr(6,2));
		var iS:int=int(fCombinedPoint.substr(8,2));		var iN:int=int(fCombinedPoint.substr(10,2));
		var iT:int=int(fCombinedPoint.substr(12,2));	var iF:int=int(fCombinedPoint.substr(14,2));
		fBtype = analizeBasicType(eS,eN,eT,eF,iS,iN,iT,iF);
		fTtype = analizeTendenciatedType(eS,eN,eT,eF,iS,iN,iT,iF);
		try{ fMainReportDate = calculateLastReport(dataset_fMainReport); }catch(e:Error){ fMainReportDate = "없음"; }
		
		viewFriendProfile();
	}
	
	private function viewFriendProfile():void{
		if(Boolean(fBtype) && Boolean(fTtype) && Boolean(bType) && Boolean(tType)){	btn_analizeRelationWithFriend.enabled = true;}else{btn_analizeRelationWithFriend.enabled = false;}
		
		lab_selectedMfSex.text = (Boolean(fSex)==true) ? ("성별 : "+fSex) : "성별 : 미등록";
		lab_selectedMfAge.text = (Boolean(fAge)==true) ? ("나이 : "+fAge) : "나이 : 미등록" ;
		lab_selectedMfBtype.text = (Boolean(fBtype)==true) ? ("기본유형 : "+fBtype) : "기본유형 : 미등록";
		lab_selectedMfTtype.text = (Boolean(fTtype)==true) ? ("경향화유형 : "+fTtype) : "경향화유형 : 미등록";
		lab_selectedMfMainReportDate.text = (Boolean(fMainReportDate)==true) ? ("메인리포트 검사일자 : "+fMainReportDate) : "메인리포트 검사일자 : 없음";
		area_selectedMfQoute.text = (Boolean(fQoute)==true) ? ("오늘의 한마디 : "+fQoute) : "오늘의 한마디 : 미등록";
	}
	
	private function readySendMsg():void{
		if(isInstalled=="true"){
			tnav_main.selectedChild = can_post;
			area_writeMsg.setFocus();
			loadMsg();
			
			checkSendMsg("F");
		}else{
			lab_notiBarInMyfriendTab.text = "앱을 설치한 친구에게만 쪽지를 보낼 수 있어요."
		}
	}
	
	private function viewFriendInfo():void{
		tnav_friend.selectedChild = can_detailInfo;
		reqCheckGetFReportMode.send();
		
		img_selectedFPicCopy.source = img_selectedMfPic.source;
		lab_selectedFDnameCopy.text = lab_selectedMfDname.text;
		lab_selectedFSexCopy.text = lab_selectedMfSex.text;
		lab_selectedFAgeCopy.text = lab_selectedMfAge.text;
		lab_selectedFBtypeCopy.text = lab_selectedMfBtype.text;
		lab_selectedFTtypeCopy.text = lab_selectedMfTtype.text;
		area_selectedFQouteCopy.text = area_selectedMfQoute.text;
	}

	private function checkedGetFReportMode(event:ResultEvent):void{
		getFReportMode = event.result.toString();
		reqGetFriendReport.send();
	}
	
	private function getFriendReport(event:ResultEvent):void{
		dataset_fReport.removeAll();
		dataset_fReport = new XMLListCollection(new XMLList(event.result.report));
		
		calculateBtypesInFChart();
		calculateTtypesInFChart();
	}
	
	private function fChartByBtype():void{
		if(dataset_fReport.length >= 2){
			lab_fChartNotibar.text = "기본유형 빈도별 차트 조회완료.";
		}else if(dataset_fReport.length == 1){
			fChartBtypes.removeAll();	fChartBtypes.addItem({type:"볼 수 없음", freq:1});
			lab_fChartNotibar.text = "차트는 2건 이상의 결과에 대해서만 지원됩니다."
		}else{
			fChartBtypes.removeAll();	fChartBtypes.addItem({type:"볼 수 없음", freq:1});
			lab_fChartNotibar.text = "테스트를 수행하지 않은 친구입니다.";
		}
		pct_fChart.dataProvider = fChartBtypes;
	}
	
	private function fChartByTtype():void{
		if(dataset_fReport.length >= 2){
			lab_fChartNotibar.text = "경향화유형 빈도별 차트 조회완료.";
		}else if(dataset_fReport.length == 1){
			fChartTtypes.removeAll();	fChartTtypes.addItem({type:"볼 수 없음", freq:1});
			lab_fChartNotibar.text = "차트는 2건 이상의 결과에 대해서만 지원됩니다."
		}else{
			fChartTtypes.removeAll();	fChartTtypes.addItem({type:"볼 수 없음", freq:1});
			lab_fChartNotibar.text = "테스트를 수행하지 않은 친구입니다.";
		}
		pct_fChart.dataProvider = fChartTtypes;
	}
	
	private function calculateBtypesInFChart():void{
		pSFM = pNTV = pSTM = pNFV = pNFM = pSTV = pNTM = pSFV = 0;
		var collectReport:ArrayCollection = new ArrayCollection;
		
		try{
		for (var i:int=0; dataset_fReport.length-1; i++){
			var combinedPoint:String = dataset_fReport[i].child("combinedPoint");
			var Btype:String = cpToType(combinedPoint, "B");
			pSFM += (Btype == "SFM")?1:0;	pNTV += (Btype == "NTV")?1:0;	pSTM += (Btype == "STM")?1:0;	pNFV += (Btype == "NFV")?1:0;
			pNFM += (Btype == "NFM")?1:0;	pSTV += (Btype == "STV")?1:0;	pNTM += (Btype == "NTM")?1:0;	pSFV += (Btype == "SFV")?1:0;
		}}catch(e:Error){}
		
		fChartBtypes = new ArrayCollection([
		{type:"SFM", freq:pSFM},{type:"NTV", freq:pNTV},{type:"STM", freq:pSTM},{type:"NFV", freq:pNFV},
		{type:"NFM", freq:pNFM},{type:"STV", freq:pSTV},{type:"NTM", freq:pNTM},{type:"SFV", freq:pSFV}]);
	}
	
	private function calculateTtypesInFChart():void{
		pSTJ = pNTJ = pSFJ = pNFJ = pSTP = pSFP = pNTP = pNFP = 0;
		var collectReport:ArrayCollection = new ArrayCollection;
		
		try{
		for (var i:int=0; dataset_fReport.length-1; i++){
			var combinedPoint:String = dataset_fReport[i].child("combinedPoint");
			var Ttype:String = cpToType(combinedPoint, "T");
			pSTJ += (Ttype == "STJ")?1:0;	pNTJ += (Ttype == "NTJ")?1:0;	pSFJ += (Ttype == "SFJ")?1:0;	pNFJ += (Ttype == "NFJ")?1:0;
			pSTP += (Ttype == "STP")?1:0;	pSFP += (Ttype == "SFP")?1:0;	pNTP += (Ttype == "NTP")?1:0;	pNFP += (Ttype == "NFP")?1:0;
		}}catch(e:Error){}

		fChartTtypes = new ArrayCollection([
		{type:"STJ", freq:pSTJ},{type:"NTJ", freq:pNTJ},{type:"SFJ", freq:pSFJ},{type:"NFJ", freq:pNFJ},
		{type:"STP", freq:pSTP},{type:"SFP", freq:pSFP},{type:"NTP", freq:pNTP},{type:"NFP", freq:pNFP}]);
	}
	
	private function viewFChartLabel(data:Object, field:String, index:Number, percentValue:Number):String{
		return data.type;
	}
	
	
/** MAP */

	
	private function startMapFriend():void{
		fMap = new NMap(map_friend, "a079f51c014345ba47308581584ec380", map_friend.width, map_friend.height);
		fMap.addEventListener(NMapEvent.INIT, onMapFriendInitHandler);
	    fMap.coordType = NCoordType.WGS84;
	}
	
	private function onMapFriendInitHandler(event:NMapEvent):void{
		var initLat:Number;
		var initLng:Number;
		if(fLat.toString().length>=5 && fLng.toString().length>=5){
			initLat = fLat;	initLng = fLng;
			lab_locationFriendNotification.text = "친구의 지역정보를 찾았습니다."
		}else{
			initLat = 127.1080041;	initLng = 37.3660835;
			lab_locationFriendNotification.text = "친구의 지역정보가 없습니다."
		}
		fMap.setCenterAndZoom(new NLatLng(initLat, initLng), 7);
                
		// 줌 컨트롤러 객체를 생성한다.
		zoomControlF = new NZoomControl();
                
		// 지도내에서의 수평/수직 정렬을 설정한다.
		zoomControlF.setAlign(HorizontalAlignment.RIGHT);
		zoomControlF.setVAlign(VerticalAlignment.TOP);
                
		// 줌 컨트롤러를 지도에 추가한다.
		fMap.addControl(zoomControlF);
                
		// 미니맵 객체를 생성한다. 설정방법은 줌 컴트롤러와 동일한다.
		indexMapF = new NIndexMap();
		indexMapF.setAlign(HorizontalAlignment.RIGHT);
		indexMapF.setVAlign(VerticalAlignment.BOTTOM);
		fMap.addControl(indexMapF);
		createMarkerF();
		
		tput_locationF.text = "위도 : "+fLat+", 경도 : "+fLng;
	}
	
	private function createMarkerF():void{
		var markParams:NMarkParams = new NMarkParams();
		markParams.label = "친구 위치";
		markParams.labelTextFormat = new TextFormat("Dotum", 12, 0x000000, true);
		markParams.dragEnabled = false;
            
		/**  위치마크 객체를 생성한다. 지도의 중심 좌표와 마커 속성을 인자값으로 설정한다. */
		placeMarkF = new NPlaceMark(fMap.getCenter(), markParams);
		fMap.addOverlay(placeMarkF);
	}
	
/** 사람찾기 */
	
	[Bindable] private var SFdname:String = "";
	[Bindable] private var SFsex:String = "";
	[Bindable] private var SFminAge:int = 0;
	[Bindable] private var SFmaxAge:int = 0;
	[Bindable] private var SFbType:String = "";
	[Bindable] private var SFtType:String = "";
	[Bindable] private var SFdistance:int = 0;
	
	[Bindable] private var encodeSFdname:String = "";
	
	private var maxSFpage:int = 0;
	private var dataset_SFlist:XMLListCollection = new XMLListCollection();	
	
	private function searchHome():void{
		switch(pContainer){
			case "naverBlog":
				ExternalInterface.call("goHome", selectedPSid);
				//link('http://section.blog.naver.com/sub/SearchBlog.nhn?type=id&option.keyword='+pDName); : deprecated
				break;
			case "naverMetoo":
				ExternalInterface.call("goHome", selectedPSid);
				//link('http://me2day.net/search_person?query='+pDName); : deprecated
				break;
		}
	}
	
	private function searchPerson():void{
		SFsex = cbx_chooseSFsex.selectedLabel;
		SFminAge = (Boolean(tput_chooseSFminAge.text)) ? int(tput_chooseSFminAge.text) : null;
		SFmaxAge = (Boolean(tput_chooseSFmaxAge.text)) ? int(tput_chooseSFmaxAge.text) : null;
		SFbType = cbx_chooseSFbType.selectedLabel;
		SFtType = cbx_chooseSFtType.selectedLabel;
		SFdistance = int(cbx_chooseSFdistance.selectedLabel);
		
		if(Boolean(SFminAge) && Boolean(SFmaxAge) && SFminAge > SFmaxAge){
			area_searchPersonNoti.text = "최소나이가 최대나이보다 큽니다.";
		}else if(cbx_chooseSFsex.selectedLabel=="" && tput_chooseSFminAge.text=="" && tput_chooseSFmaxAge.text=="" && cbx_chooseSFbType.selectedLabel=="" && cbx_chooseSFtType.selectedLabel=="" && cbx_chooseSFdistance.selectedLabel==""){
			area_searchPersonNoti.text = "검색조건을 입력해주세요.";
		}else{
			reqSearchPerson.send();
		}
	}
	
	private function searchedPerson(event:ResultEvent):void{
		dataset_SFlist.removeAll();
		dataset_SFlist = new XMLListCollection(new XMLList(event.result.person));
		
		tput_sfCurrentPage.text = "1";
		maxSFpage = Math.ceil(dataset_SFlist.length / 6);
		lab_sfTotalPage.text = maxSFpage.toString();
		
		if(dataset_SFlist.length>=1){
			viewSearchedPersonsList(1);
			area_searchPersonNoti.text = "조건에 맞는 "+ dataset_SFlist.length +" 명의 사람들을 찾았습니다";
		}else{
			area_searchPersonNoti.text = "조건에 부합하는 사람이 아무도 없습니다.";
		}
	}
	
	private function searchPersonByDname():void{
		SFdname = tput_chooseSFdName.text;
		encodeSFdname = escape(SFdname);
		
		if(Boolean(SFdname)==false){
			area_searchPersonNoti.text = "검색할 닉네임을 입력하세요.";
		}else{
			reqSearchPersonByDname.send();
		}
	}
	
	private function viewSearchedPersonsList(page:int):void{
		dataset_SFlist[6*(page-1)].child("pic")
		
		// initialize
		img_picSf1.source=img_picSf2.source=img_picSf3.source=img_picSf4.source=img_picSf5.source=img_picSf6.source="";
		lab_dnameSf1.text=lab_dnameSf2.text=lab_dnameSf3.text=lab_dnameSf4.text=lab_dnameSf5.text=lab_dnameSf6.text="";
		
		vbx_personBox1.visible = vbx_personBox2.visible = vbx_personBox3.visible = vbx_personBox4.visible = vbx_personBox5.visible = vbx_personBox6.visible = false;
		vbx_personBox1.visible = vbx_personBox2.visible = vbx_personBox3.visible = vbx_personBox4.visible = vbx_personBox5.visible = vbx_personBox6.visible = true;
		// 컨트롤배열이 불가능해서 일일히 해당 index가 존재하는지 검증. 
		try{ img_picSf1.source = unescape(dataset_SFlist[6*page-6].child("pic")); }catch(e:Error){}
		try{ img_picSf2.source = unescape(dataset_SFlist[6*page-5].child("pic")); }catch(e:Error){}
		try{ img_picSf3.source = unescape(dataset_SFlist[6*page-4].child("pic")); }catch(e:Error){}
		try{ img_picSf4.source = unescape(dataset_SFlist[6*page-3].child("pic")); }catch(e:Error){}
		try{ img_picSf5.source = unescape(dataset_SFlist[6*page-2].child("pic")); }catch(e:Error){}
		try{ img_picSf6.source = unescape(dataset_SFlist[6*page-1].child("pic")); }catch(e:Error){}
		
		try{ lab_dnameSf1.text = unescape(dataset_SFlist[6*page-6].child("nickname")); }catch(e:Error){}
		try{ lab_dnameSf2.text = unescape(dataset_SFlist[6*page-5].child("nickname")); }catch(e:Error){}
		try{ lab_dnameSf3.text = unescape(dataset_SFlist[6*page-4].child("nickname")); }catch(e:Error){}
		try{ lab_dnameSf4.text = unescape(dataset_SFlist[6*page-3].child("nickname")); }catch(e:Error){}
		try{ lab_dnameSf5.text = unescape(dataset_SFlist[6*page-2].child("nickname")); }catch(e:Error){}
		try{ lab_dnameSf6.text = unescape(dataset_SFlist[6*page-1].child("nickname")); }catch(e:Error){}
		
		// init selectedSF viewing
		img_selectedSfPic.source = "";	lab_selectedSfDname.text = "";	lab_selectedSfcontainer.text = "";	lab_selectedSfSex.text = "";	lab_selectedSfAge.text = "";	lab_selectedSfBtype.text = "";	lab_selectedSfTtype.text = ""; lab_selectedSfMainReportDate.text = "";
		btn_searchHome.enabled = false;
		btn_readySendMsgToPerson.enabled = false;
		btn_viewPersonInfo.enabled = false;
	}
	
	private function clickedSfPanel(selectedPanel:int):void{
		lab_fChartNotibar.text = "유형별 결과빈도를 차트로 보여드립니다. 원하는 유형을 클릭하세요.";
		pct_fChart.dataProvider = new ArrayCollection();
		setSelectedSfInfo(selectedPanel);
	}
	private function setSelectedSfInfo(selectedSfPanel:int):void{
		var selectedSfIndex:int = 6*(int(tput_sfCurrentPage.text)-1)+selectedSfPanel-1;
		selectedPMainReportNum = dataset_SFlist[selectedSfIndex].child("mainReport");
		
		img_selectedSfPic.source = unescape(dataset_SFlist[selectedSfIndex].child("pic"));	// plpicURL
		
		selectedPSid = dataset_SFlist[selectedSfIndex].child("sid");
		pDName = unescape(dataset_SFlist[selectedSfIndex].child("nickname"));
		pContainer = analizeContainer(selectedPSid);
		pSex = dataset_SFlist[selectedSfIndex].child("sex");
		pAge = dataset_SFlist[selectedSfIndex].child("age");
		pQoute = unescape(dataset_SFlist[selectedSfIndex].child("qoute"));
		fLat = (Boolean(dataset_SFlist[selectedSfIndex].child("lat"))) ? Number(dataset_SFlist[selectedSfIndex].child("lat")) : null;
		fLng = (Boolean(dataset_SFlist[selectedSfIndex].child("lng"))) ? Number(dataset_SFlist[selectedSfIndex].child("lng")) : null;
		reqGetPersonMainReport.send();
	}
	
	private function getPersonMainReport(event:ResultEvent):void{
		dataset_pMainReport.removeAll();
		dataset_pMainReport = new XMLListCollection(new XMLList(event.result));
		
		var pCombinedPoint:String = dataset_pMainReport.child("combinedPoint").text().toString();

		var eS:int=int(pCombinedPoint.substr(0,2));		var eN:int=int(pCombinedPoint.substr(2,2));
		var eT:int=int(pCombinedPoint.substr(4,2));		var eF:int=int(pCombinedPoint.substr(6,2));
		var iS:int=int(pCombinedPoint.substr(8,2));		var iN:int=int(pCombinedPoint.substr(10,2));
		var iT:int=int(pCombinedPoint.substr(12,2));	var iF:int=int(pCombinedPoint.substr(14,2));
		pBtype = analizeBasicType(eS,eN,eT,eF,iS,iN,iT,iF);
		pTtype = analizeTendenciatedType(eS,eN,eT,eF,iS,iN,iT,iF);
		try{ pMainReportDate = calculateLastReport(dataset_pMainReport); }catch(e:Error){ pMainReportDate = "없음";}
		
		viewPersonProfile();
	}
	
	private function viewPersonProfile():void{
		// 버튼 활성화 조건 관리
		if(Boolean(pDName)){
			if(pContainer == "naverBlog" || pContainer == "naverMetoo"){
				switch(pContainer){
					case "naverBlog":
						btn_searchHome.label = "블로그 방문";
						break;
					case "naverMetoo":
						btn_searchHome.label = "미투 방문";
						break;
				}
				btn_searchHome.enabled = true;
			}else{
				btn_searchHome.enabled = false;
			}
		}else{
			btn_searchHome.enabled = false;
		}
			
		if(Boolean(pDName)){btn_readySendMsgToPerson.enabled = true;}else{btn_readySendMsgToPerson.enabled = false;}
		btn_viewPersonInfo.enabled = true;
		
		if(Boolean(pBtype) && Boolean(pTtype) && Boolean(bType) && Boolean(tType)){btn_analizeRelationWithPerson.enabled = true;}else{btn_analizeRelationWithPerson.enabled = false;}
		
		// 정보 출력
		lab_selectedSfDname.text = (Boolean(pDName)==true) ? pDName : "";
		lab_selectedSfcontainer.text = (Boolean(pContainer)==true) ? ("컨테이너 : "+pContainer) : "컨테이너 : 알 수 없음";
		lab_selectedSfSex.text = (Boolean(pSex)==true) ? ("성별 : "+pSex) : "성별 : 미등록";
		lab_selectedSfAge.text = (Boolean(pAge)==true) ? ("나이 : "+pAge) : "나이 : 미등록" ;
		lab_selectedSfBtype.text = (Boolean(pBtype)==true) ? ("기본유형 : "+pBtype) : "기본유형 : 미등록";
		lab_selectedSfTtype.text = (Boolean(pTtype)==true) ? ("경향화유형 : "+pTtype) : "경향화유형 : 미등록";
		lab_selectedSfMainReportDate.text = (Boolean(pMainReportDate)==true) ? ("메인리포트 검사일자 : "+pMainReportDate) : "메인리포트 검사일자 : 없음";
		area_selectedSfQoute.text = (Boolean(pQoute)==true) ? ("오늘의 한마디 : "+pQoute) : "오늘의 한마디 : 미등록";
		
		startMapFriend();
	}
	
	private function previousSfPage():void{
		if(int(tput_sfCurrentPage.text)>1){
			var previousPage:int = int(tput_sfCurrentPage.text)-1;
			tput_sfCurrentPage.text = previousPage.toString();
			viewSearchedPersonsList(previousPage);
		}
	}
	
	private function nextSfPage():void{
		if(int(tput_sfCurrentPage.text)<maxSFpage){
			var nextPage:int = int(tput_sfCurrentPage.text)+1;
			tput_sfCurrentPage.text = nextPage.toString();
			viewSearchedPersonsList(nextPage);
		}
	}
	
	private function analizeContainer(sid:String):String{
		var thisContainerName:String = "";
		if(sid.length == 19){
			switch(sid.substr(0,2)){
				case "11":
					thisContainerName = "naverBlog";
					break;
				case "12":
					thisContainerName = "naverCafe";
					break;
				case "13":
					thisContainerName = "naverMetoo";
					break;
			}
		}else if(sid.length == 8){
			thisContainerName = "cyworld";
		}
		
		if(Boolean(thisContainerName)==false){thisContainerName = "unknown";}
		return thisContainerName;
	}
	
	private function readySendMsgToPerson():void{
		tnav_main.selectedChild = can_post;
		area_writeMsg.setFocus();
		loadMsg();
		
		checkSendMsg("P");
	}
	
	private function viewPersonInfo():void{
		tnav_friend.selectedChild = can_detailInfo;
		reqCheckGetPReportMode.send();
		
		img_selectedFPicCopy.source = img_selectedSfPic.source;
		lab_selectedFDnameCopy.text = lab_selectedSfDname.text;
		lab_selectedFSexCopy.text = lab_selectedSfSex.text;
		lab_selectedFAgeCopy.text = lab_selectedSfAge.text;
		lab_selectedFBtypeCopy.text = lab_selectedSfBtype.text;
		lab_selectedFTtypeCopy.text = lab_selectedSfTtype.text;
		area_selectedFQouteCopy.text = area_selectedSfQoute.text;
	}
	
	private function checkedGetPReportMode(event:ResultEvent):void{
		getPReportMode = event.result.toString();
		reqGetPersonReport.send();
	}
	
	private function getPersonReport(event:ResultEvent):void{
		dataset_fReport.removeAll();
		dataset_fReport = new XMLListCollection(new XMLList(event.result.report));
		
		calculateBtypesInFChart();
		calculateTtypesInFChart();
	}
	
	private function changeCurrentSfPage():void{
		if(int(tput_sfCurrentPage.text)>=1 && int(tput_sfCurrentPage.text)<=maxSFpage){
			var goPage:int = int(tput_sfCurrentPage.text);
			viewSearchedPersonsList(goPage);
		}else{
			tput_sfCurrentPage.text = "1"
		}
	}
	
/** 관계분석 */
	
	private var dataset_mMainReport:XMLListCollection = new XMLListCollection();
	private var dataset_oMainReport:XMLListCollection = new XMLListCollection();
	private var relation_conversation:String = "";
	private var relation_perspective:String = "";
	private var relation_communication:String = "";
	private var me_dName:String = "";
	private var other_dName:String = "";
	
	private var me_eS:int = 0;	private var me_eN:int = 0;
	private var me_eT:int = 0;	private var me_eF:int = 0;
	private var me_iS:int = 0;	private var me_iN:int = 0;
	private var me_iT:int = 0;	private var me_iF:int = 0;
	
	private var other_eS:int = 0;	private var other_eN:int = 0;
	private var other_eT:int = 0;	private var other_eF:int = 0;
	private var other_iS:int = 0;	private var other_iN:int = 0;
	private var other_iT:int = 0;	private var other_iF:int = 0;
	
	private var me_eP:int = 0;	private var other_eP:int = 0;
	private var me_eJ:int = 0; 	private var other_eJ:int = 0;
	private var me_ePtype:String = "";	private var other_ePtype:String = "";
	private var me_eJtype:String = "";	private var other_eJtype:String = "";
	
	private var selectedRelationType:String = "";
	
	private function analizeRelation(mode:String):void{
		tnav_friend.selectedChild = can_analizeRelation;
		acc_relation.selectedChild = can_relationTypes;
		
		// relation init
		img_relationMePic.source = img_proPic.source;
		lab_relationMeDname.text = me_dName = lab_dispName.text;
		dataset_mMainReport = dataset_mainReport;
		
		switch(mode){
			case 'friend':	
				img_relationOtherPic.source = img_selectedMfPic.source;
				lab_relationOtherDname.text = other_dName = lab_selectedMfDname.text;
				dataset_oMainReport.removeAll();	dataset_oMainReport = dataset_fMainReport;
				break;
			case 'person':	
				img_relationOtherPic.source = img_selectedSfPic.source;
				lab_relationOtherDname.text = other_dName = lab_selectedSfDname.text;
				dataset_oMainReport.removeAll();	dataset_oMainReport = dataset_pMainReport;
				break;
		}
		img_relationMePic.visible = false;	img_relationOtherPic.visible = false;
		img_relationMePic.visible = true;	img_relationOtherPic.visible = true;
		
		lab_relationMeBtype.text = "기본유형 : "+bType;
		lab_relationMeTtype.text = "경향화유형 : "+tType;
		switch(mode){
			case 'friend':
				lab_relationOtherBtype.text = "기본유형 : "+fBtype;
				lab_relationOtherTtype.text = "경향화유형 : "+fTtype;
				break;
			case 'person':
				lab_relationOtherBtype.text = "기본유형 : "+pBtype;
				lab_relationOtherTtype.text = "경향화유형 : "+pTtype;
		}
		
		var mCombinedPoint:String = dataset_mMainReport.child("combinedPoint").text().toString();
		me_eS=int(mCombinedPoint.substr(0,2));		me_eN=int(mCombinedPoint.substr(2,2));
		me_eT=int(mCombinedPoint.substr(4,2));		me_eF=int(mCombinedPoint.substr(6,2));
		me_iS=int(mCombinedPoint.substr(8,2));		me_iN=int(mCombinedPoint.substr(10,2));
		me_iT=int(mCombinedPoint.substr(12,2));		me_iF=int(mCombinedPoint.substr(14,2));
		
		var oCombinedPoint:String = dataset_oMainReport.child("combinedPoint").text().toString();
		other_eS=int(oCombinedPoint.substr(0,2));		other_eN=int(oCombinedPoint.substr(2,2));
		other_eT=int(oCombinedPoint.substr(4,2));		other_eF=int(oCombinedPoint.substr(6,2));
		other_iS=int(oCombinedPoint.substr(8,2));		other_iN=int(oCombinedPoint.substr(10,2));
		other_iT=int(oCombinedPoint.substr(12,2));		other_iF=int(oCombinedPoint.substr(14,2));
		
		lab_relationMeReliability.text = "정확도 : "+analizeReliability(me_eS, me_eN, me_eT, me_eF, me_iS, me_iN, me_iT, me_iF)+"%";
		lab_relationOtherReliability.text = "정확도 : "+analizeReliability(other_eS, other_eN, other_eT, other_eF, other_iS, other_iN, other_iT, other_iF)+"%";
		lab_relationReliability.text = analizeRelationReliability()+"%";
		
		// relation setting
		me_eP = me_eS + me_eN;	other_eP = other_eS + other_eN;
		me_eJ = me_eT + me_eF;	other_eJ = other_eT + other_eF;
		
		if(me_eP >= me_eJ && other_eP >= other_eJ){
			relation_conversation = "HH";
			img_relationConversation.source = 'img/relationDirectionHH.png';
			area_aboutConversation.text = me_dName+"님과 "+other_dName+"님이 서로 듣고자 합니다.";
			clearContextPic();
		}else if(me_eP < me_eJ && other_eP < other_eJ){
			relation_conversation = "SS";
			img_relationConversation.source = 'img/relationDirectionSS.png';
			area_aboutConversation.text = me_dName+"님과 "+other_dName+"님이 서로 말하고자 합니다.";
			clearContextPic();
		}else{
			relation_conversation = "SH";
			img_relationConversation.source = 'img/relationDirectionSH.png';
			if(me_eP < me_eJ && other_eP >= other_eJ){
				area_aboutConversation.text = me_dName+"님이 "+other_dName+"님에게 말하는 경향입니다.";
			}else if(me_eP >= me_eJ && other_eP < other_eJ){
				area_aboutConversation.text = other_dName+"님이 "+me_dName+"님에게 말하는 경향입니다.";
			}
			clearContextPic();
		}
		
		me_ePtype = (me_eS >= me_eN) ? "S" : "N";	other_ePtype = (other_eS >= other_eN) ? "S" : "N";
		
		if(me_ePtype == other_ePtype){
			relation_perspective = "SideBySide";
			img_relationPerspective.source = 'img/relationSideBySide.png';
			if(me_ePtype == "S"){
				area_aboutPerspective.text = me_dName+"님과 "+other_dName+"님은 보고 듣는 경향이 감각적(실체중심적)으로 같습니다.";
			}else if(me_ePtype == "N"){
				area_aboutPerspective.text = me_dName+"님과 "+other_dName+"님은 보고 듣는 경향히 직관적(가능성중심)으로 같습니다.";
			}
			clearContextPic();
		}else{
			relation_perspective = "Opposite";
			img_relationPerspective.source = 'img/relationOpposite.png';
			if(me_ePtype == "S"){
				area_aboutPerspective.text = me_dName+"님은 감각적(실체중심적) "+other_dName+"님은 직관적(가능성중심)으로 보고 듣는 경향이 다릅니다.";
			}else if(me_ePtype == "N"){
				area_aboutPerspective.text = me_dName+"님은 직관적(가능성중심) "+other_dName+"님은 감각적(실체중심적)으로 보고 듣는 경향이 다릅니다.";
			}
			clearContextPic();
		}
		
		me_eJtype = (me_eT >= me_eF) ? "T" : "F";	other_eJtype = (other_eT >= other_eF) ? "T" : "F";
		
		if(me_eJtype == other_eJtype){
			relation_communication = "SideBySide";
			img_relationCommunication.source = 'img/relationSideBySide.png';
			if(me_eJtype == "T"){
				area_aboutCommunication.text = me_dName+"님과 "+other_dName+"님은 표현하는 경향이 사고적(합리중심)으로 같습니다.";
			}else if(me_eJtype == "F"){
				area_aboutCommunication.text = me_dName+"님과 "+other_dName+"님은 표현하는 경향이 감정적(감동중심)으로 같습니다.";
			}
			clearContextPic();
		}else{
			relation_communication = "Opposite";
			img_relationCommunication.source = 'img/relationOpposite.png';
			if(me_eJtype == "T"){
				area_aboutCommunication.text = me_dName+"님은 사고적(합리중시) "+other_dName+"님은 감정적(감동중시)으로 표현하는 경향이 다릅니다.";
			}else if(me_eJtype == "F"){
				area_aboutCommunication.text = me_dName+"님은 감정적(감동중시) "+other_dName+"님은 사고적(합리중시)으로 표현하는 경향이 다릅니다.";
			}
			clearContextPic();
		}
		
		lab_labelRelationTypes.text = "아래 그림을 클릭하시면 자세한 내용을 볼 수 있습니다.";
		fadeRefreshRelationTypes();
		
	}
	
	private function clearContextPic():void{
		img_relationContextPic1.source = img_relationContextPic2.source = img_relationContextPic3.source = "";
	}
	
	private function viewRelation(mode:String):void{
		
		acc_relation.selectedChild = can_relationContext;
		selectedRelationType = mode;
		
		switch(mode){
			case "conversation":
				if(relation_conversation == "SH"){
					img_relationContextPic1.source = 'img/relationDirectionSH.png';
					img_relationContextPic2.source = 'img/relationDirectionSS_gray.png';
					img_relationContextPic3.source = 'img/relationDirectionHH_gray.png';
				}else if(relation_conversation == "SS"){
					img_relationContextPic1.source = 'img/relationDirectionSH_gray.png';
					img_relationContextPic2.source = 'img/relationDirectionSS.png';
					img_relationContextPic3.source = 'img/relationDirectionHH_gray.png';
				}else if(relation_conversation == "HH"){
					img_relationContextPic1.source = 'img/relationDirectionSH_gray.png';
					img_relationContextPic2.source = 'img/relationDirectionSS_gray.png';
					img_relationContextPic3.source = 'img/relationDirectionHH.png';
				}
				fadeRefreshRelationContextPic("3");
				break;
			case "perspective":
				if(relation_perspective == "SideBySide"){
					img_relationContextPic1.source = 'img/relationSideBySide.png';
					img_relationContextPic2.source = 'img/relationOpposite_gray.png';
					img_relationContextPic3.source = "";
				}else if(relation_perspective == "Opposite"){
					img_relationContextPic1.source = 'img/relationSideBySide_gray.png';
					img_relationContextPic2.source = 'img/relationOpposite.png';
					img_relationContextPic3.source = "";
				}
				fadeRefreshRelationContextPic("2");
				break;
			case "communication":
				if(relation_communication == "SideBySide"){
					img_relationContextPic1.source = 'img/relationSideBySide.png';
					img_relationContextPic2.source = 'img/relationOpposite_gray.png';
					img_relationContextPic3.source = "";
				}else if(relation_communication == "Opposite"){
					img_relationContextPic1.source = 'img/relationSideBySide_gray.png';
					img_relationContextPic2.source = 'img/relationOpposite.png';
					img_relationContextPic3.source = "";
				}
				fadeRefreshRelationContextPic("2");
				break;
		}
		
		area_relationPercentage.text = "";
		area_relationContext.text = "";
	}
	
	private function selectedRelationContext(pickNum:String):void{
		switch(selectedRelationType){
			case "conversation":
				switch(pickNum){
					case "1":
						if(relation_conversation == "SH"){
							analizeRelationPercentage("conversation");
						}else{area_relationPercentage.text = other_dName+"님과 해당되는 관계가 아닙니다.";}	
						area_relationContext.text = strConversation_SH;
						break;
					case "2":
						if(relation_conversation == "SS"){
							analizeRelationPercentage("conversation");
						}else{area_relationPercentage.text = other_dName+"님과 해당되는 관계가 아닙니다.";}	
						area_relationContext.text = strConversation_SS;
						break;
					case "3":
						if(relation_conversation == "HH"){
							analizeRelationPercentage("conversation");
						}else{area_relationPercentage.text = other_dName+"님과 해당되는 관계가 아닙니다.";}	
						area_relationContext.text = strConversation_HH;
						break;
				}break;
			case "perspective":
				switch(pickNum){
					case "1":
						if(relation_perspective == "SideBySide"){
							analizeRelationPercentage("perspective");
						}else{area_relationPercentage.text = other_dName+"님과 해당되는 관계가 아닙니다.";}	
						area_relationContext.text = strPerspective_SideBySide;
						break;
					case "2":
						if(relation_perspective == "Opposite"){
							analizeRelationPercentage("perspective");
						}else{area_relationPercentage.text = other_dName+"님과 해당되는 관계가 아닙니다.";}
						area_relationContext.text = strPerspective_Opposite;	
						break;
				}break;
			case "communication":
				switch(pickNum){
					case "1":
						if(relation_communication == "SideBySide"){
							analizeRelationPercentage("communication");
						}else{area_relationPercentage.text = other_dName+"님과 해당되는 관계가 아닙니다.";}	
						area_relationContext.text = strCommunication_SideBySide;
						break;
					case "2":
						if(relation_communication == "Opposite"){
							analizeRelationPercentage("communication");
						}else{area_relationPercentage.text = other_dName+"님과 해당되는 관계가 아닙니다.";}	
						area_relationContext.text = strCommunication_Opposite;
						break;
				}break;
		}
		fadeRefreshRelationContextDiscription();
	}
	
	private function analizeRelationPercentage(mode:String):void{
		var temp:String = null;
		switch(mode){
			case "conversation":
				temp = me_dName+"님의 지향성\r";
				if(me_eP + me_eJ != 0){
					if(me_eP >= me_eJ){
						temp += "인식적 : "+((me_eP - me_eJ)/(me_eP + me_eJ)*100).toString().substr(0,5)+"%\r\r";
					}else if(me_eP < me_eJ){
						temp += "판단적 : "+((me_eJ - me_eP)/(me_eP + me_eJ)*100).toString().substr(0,5)+"%\r\r";
					}
				}else{	temp += "인식적 : 0%(구분불가)\r\r";}
				
				temp += other_dName+"님의 지향성\r";
				if(other_eP + other_eJ != 0){
					if(other_eP >= other_eJ){
						temp += "인식적 : "+((other_eP - other_eJ)/(other_eP + other_eJ)*100).toString().substr(0,5)+"%\r\r";
					}else if(other_eP < other_eJ){
						temp += "판단적 : "+((other_eJ - other_eP)/(other_eP + other_eJ)*100).toString().substr(0,5)+"%\r\r";
					}
				}else{	temp += "인식적 : 0%(구분불가)\r\r";}
				
				break;
			case "perspective":
				temp = me_dName+"님의 관찰법\r";
				if(me_eS + me_eN != 0){
					if(me_eS >= me_eN){
						temp += "감각(실체)적 : "+((me_eS - me_eN)/(me_eS + me_eN)*100).toString().substr(0,5)+"%\r\r";
					}else if(me_eS < me_eN){
						temp += "직관(직감)적 : "+((me_eN - me_eS)/(me_eS + me_eN)*100).toString().substr(0,5)+"%\r\r";
					}
				}else{	temp += "감각(실체)적 : 0%(구분불가)\r\r";}
				
				temp += other_dName+"님의 관찰법\r";
				if(other_eS + other_eN != 0){
					if(other_eS >= other_eN){
						temp += "감각(실체)적 : "+((other_eS - other_eN)/(other_eS + other_eN)*100).toString().substr(0,5)+"%\r\r";
					}else if(other_eS < other_eN){
						temp += "직관(직감)적 : "+((other_eN - other_eS)/(other_eS + other_eN)*100).toString().substr(0,5)+"%\r\r";
					}
				}else{	temp += "감각(실체)적 : 0%(구분불가)\r\r";}
				
				break;
			case "communication":
				temp = me_dName+"님의 표현법\r";
				if(me_eT + me_eF != 0){
					if(me_eT >= me_eF){
						temp += "사고(합리)적 : "+((me_eT - me_eF)/(me_eT + me_eF)*100).toString().substr(0,5)+"%\r\r";
					}else if(me_eT < me_eF){
						temp += "감정(감동)적 : "+((me_eF - me_eT)/(me_eT + me_eF)*100).toString().substr(0,5)+"%\r\r";
					}
				}else{	temp += "사고(합리)적 : 0%(구분불가)\r\r";}
			
				temp += other_dName+"님의 표현법\r";
				if(other_eT + other_eF != 0){
					if(other_eT >= other_eF){
						temp += "사고(합리)적 : "+((other_eT - other_eF)/(other_eT + other_eF)*100).toString().substr(0,5)+"%\r\r";
					}else if(other_eT < other_eF){
						temp += "감정(감동)적 : "+((other_eF - other_eT)/(other_eT + other_eF)*100).toString().substr(0,5)+"%\r\r";
					}
				}else{	temp += "사고(합리)적 : 0%(구분불가)\r\r";}
				
				break;
		}
		area_relationPercentage.text = temp;
	}
	
	